﻿#ifndef XMLSTREAMREADER_H
#define XMLSTREAMREADER_H
#include<QXmlStreamReader>
#include<vector>
#include <QObject>
#include<QFile>
#include<QDomDocument> //文件
#include<QDomProcessingInstruction> //格式头
#include<QDomElement> // 元素
#include<QTextStream>
#include<QDateTime>
#include<QDebug>
namespace xmlParams
{

struct cameraParams
{
    std::string params;
    int width;
    int height;
    int videoAOIX;
    int videoAOIY;
    int exposureTime;
    cameraParams(std::string params_,int width_, int height_, int videoAOIX_,int videoAOIY_,int exposureTime_)
        : params(std::move(params_)),width(width_), height(height_), videoAOIX(videoAOIX_),
          videoAOIY(videoAOIY_),exposureTime(exposureTime_)
    {

    }
};

struct armorParams
{
    std::string params;
    std::string enemyColor;
    int offsetX;
    int offsetY;

    armorParams(std::string params_,std::string enemyColor_, int offsetX_, int offsetY_)
        :params(std::move(params_)), enemyColor(std::move(enemyColor_)), offsetX(offsetX_), offsetY(offsetY_)
    {

    }
};
struct buffParams
{
    std::string params;
    int offsetX;
    int offsetY;
    double vGain;

    buffParams(std::string params_,int offsetX_, int offsetY_, double vGain_)
        : params(std::move(params_)) ,offsetX(offsetX_), offsetY(offsetY_), vGain(vGain_)
    {

    }
};
}
class XmlStreamReader : public QObject
{
    Q_OBJECT
public:
    explicit XmlStreamReader(QObject *parent = nullptr);
    bool readFile(const QString& fileName);
    static void creatXML(QString fileName);
    static void appendXML(QString filePath , QStringList list);
    static void writeXML(QDomDocument &doc,QDomElement &root,QStringList &list);
    static void readXML(QString filePath , QStringList &listCamera ,QStringList &listArmor,QStringList &listBuff);
private:

private:
    QXmlStreamReader reader;

signals:

};

#endif // XMLSTREAMREADER_H
